//
//  AY_AudioBookCell.m
//  AiYue
//
//  Created by mac on 2023/11/14.
//

#import "AY_AudioBookCell.h"

@interface AY_AudioBookCell()

/** 书 */
@property (strong,nonatomic) UIImageView *bookImage;

/** 书名 */
@property (strong,nonatomic) UILabel *bookName;
@end

@implementation AY_AudioBookCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.bookImage = [AYTool createImageViewWithFrame:CGRectZero andImage:nil andBg:nil andRadius:YNUM(4) andAddSubView:self.contentView];
        [self.bookImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(YNUM(88));
            make.left.right.top.equalTo(self.contentView);
        }];
        
        self.bookName = [AYTool createLabelWithFrame:CGRectZero andText:nil andTextColor:[UIColor whiteColor] andBgColor:nil andFont:YFont(12) andLines:1 andRadius:0 andAddSubView:self.contentView];
        self.bookName.textAlignment = NSTextAlignmentCenter;
        [self.bookName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.bookImage.mas_bottom).offset(YNUM(5));
            make.left.right.equalTo(self.bookImage);
        }];
    }
    return self;
}

- (void)setModel:(BookModel *)model {
    [self.bookImage sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:YImage(@"placeholderImage")];
    self.bookName.text = model.name;
}
@end
